package com.example.Laboratory.Service.Impl;

import com.example.Laboratory.Entity.Suspended_frame;
import com.example.Laboratory.Mapper.Suspended_frameMapper;
import com.example.Laboratory.Service.Suspended_frameService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class Suspended_frameServiceImpl implements Suspended_frameService {


    @Autowired
    Suspended_frameMapper suspended_frameMapper;


    //添加悬浮框信息
    @Override
    public String addSuspended_frame(Suspended_frame t) {
        if (suspended_frameMapper.researchSuspended_frame2() > 1) {
            if (suspended_frameMapper.addSuspended_frame(t) == 1) {
                return "添加成功";
            } else {
                return "添加失败";
            }
        } else {
            return "已经有信息";
        }
    }

    //删除悬浮框信息
    @Override
    public String deleteSuspended_frame(int suspended_frame_id) {
        if (suspended_frameMapper.deleteSuspended_frame(suspended_frame_id) == 1) {
            return "删除成功";
        } else {
            return "删除失败";
        }
    }

    //查询悬浮框信息
    @Override
    public Suspended_frame selectSuspended_frame() {
        return suspended_frameMapper.researchSuspended_frame();
    }

    //更新悬浮框信息
    @Override
    public String updateSuspended_frame(Suspended_frame i) {
        if (suspended_frameMapper.reviseSuspended_frame(i) == 1) {
            return "修改成功";
        } else {
            return "修改失败";
        }
    }
}
